<?php
include "../tambah/date.php";
include "../txt/url.php";
$per_page=8;
include_once('../Connections/sepolwan_connect.php');
if(isset($_POST['pageLimit']) && !empty($_POST['pageLimit'])){
    $pageLimit=$_POST['pageLimit'];
}else{
    $pageLimit='0';
}
$pageLimit=$pageLimit;

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
mysql_select_db($database_sepolwan_connect, $sepolwan_connect);
$query_tl_user = "SELECT * FROM memberdb WHERE aktif = 'ya' ORDER BY id DESC limit ".$pageLimit.",".$per_page;
$tl_user = mysql_query($query_tl_user, $sepolwan_connect) or die(mysql_error());
$row_tl_user = mysql_fetch_assoc($tl_user);
$totalRows_tl_user = mysql_num_rows($tl_user);
?>
<?php 

 if ($totalRows_tl_user > 0) { // Show if recordset not empty ?>
  
  
  
  <table width="950" border="0" align="center" cellpadding="0" cellspacing="0">
         <tr>
         <?php $kolom = 4;
		$i = 0; if  ($totalRows_tl_user>0) { do { 
		if ($i >= $kolom) {
        echo "<tr></tr>";
        $i = 0;
    }
    $i++;
		?>
          <?php
	
$angka = $d++; //mengambil isi dari textbox dan memasukkan ke variabel angka
if (($angka % 4) == 0) { //jika angka di bagi 2 hasilnya 0
echo ""; //cetak angka dan angka adalah bilangan genap
} else
echo "<td width='10'>&nbsp;</td>"; //cetak angka dan angka adalah bilangan ganjil
?>
           <td width="230" align="center" valign="top">
  <div style="width:230px; height:230px; overflow:hidden; border:1px solid #CCC"><a href="../<?php echo $row_tl_user['nama_user'] ?>" target="_parent"><img src="<?php if($row_tl_user['foto_profile']<>NULL){ if (file_exists("../images/member/ava/resize_230_230_".$row_tl_user['foto_profile'])) { echo "../images/member/ava/resize_230_230_".$row_tl_user['foto_profile']; } else { if (file_exists("../images/member/ava/".$row_tl_user['foto_profile'])) { echo "../images/member/ava/tester_230_230_".$row_tl_user['foto_profile']; } else { echo "../images/member/ava/resize_230_230_default.jpg"; } } } else { echo "../images/member/ava/resize_230_230_default.jpg"; }  ?>" /></a> </div>
<div style="width:200px; background:#FFF; padding:15px; border:1px solid #CCC"><strong><?php if (strlen($row_tl_user['full_name'])>17) { echo substr($row_tl_user['full_name'],0,17)." ..."; } else { echo $row_tl_user['full_name']; } ?></strong><br />

  ( <a href="../<?php echo $row_tl_user['nama_user'] ?>"><?php if (strlen($row_tl_user['nama_user'])>17) { echo substr($row_tl_user['nama_user'],0,17)." ..."; } else { echo $row_tl_user['nama_user']; } ?></a> )
 </div><br /></td>
	
	<?php
	
	 } while ($row_tl_user = mysql_fetch_array($tl_user)); } ?>
         </tr>
       </table>
  
  
  
  <?php
$loadCount=$pageLimit+$per_page;
 if($totalRows_tl_user >= $per_page){ ?>
       <div class="load_more_link">
       <input type="button" class="button" value="Load More" 
       onclick=loadData(<?php echo $loadCount ?>)>
       <span class="flash"></span></div> <?php
 }
}else{
       echo 'No Data Found';
}
  
mysql_free_result($tl_user);
?>